home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK2.toast / Development Kits (Disc 2) / QuickDraw GX / Programming Stuff / Sample Code / Typography Samples / Dave’s Fab Samples ƒ / Direction Overrides.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-10  |  1.3 KB  |  66 lines  |  [TEXT/KAHL]

  1. #include <Types.h>
  2. #include <QuickDraw.h>
  3. #include <Fonts.h>
  4. #include <Windows.h>
  5. #include <Menus.h>
  6. #include <SegLoad.h>
  7. #include <Memory.h>
  8. #include <Desk.h>
  9.  
  10. #include "graphics routines.h"
  11. #include "graphics libraries.h"
  12. #include "graphics toolbox.h"
  13.  
  14. #include "layout types.h"
  15. #include "layout routines.h"
  16. #include "layout library.h"
  17.  
  18. #include "SampleInterface.h"
  19.  
  20. short MyStrLen(char *x);
  21. static short MyStrLen(x)
  22. char    *x;
  23.     {
  24.     short c = 0;
  25.     while (*x++) c++;
  26.     return c;
  27.     }    /* MyStrLen */
  28.  
  29. void DirectionOverrides(WindowPtr sampleWindow)
  30.     {
  31.     /* Variables */
  32.     char        *myString = "abc def ghi";
  33.     gxPoint        myPoint;
  34.     gxRunControls    gxRunControls;
  35.     gxShape        layout;
  36.     short        len, level = 0;
  37.     gxStyle        myStyle;
  38.     gxViewPort    aViewPort;
  39.     
  40.     /* Initialization */
  41.  
  42.     myPoint.x = ff(20);
  43.     myPoint.y = ff(50);
  44.  
  45.     aViewPort = GXNewWindowViewPort(sampleWindow);
  46.     SetDefaultViewPort(aViewPort);
  47.  
  48.     len = MyStrLen(myString);
  49.     InitializeRunControls(&gxRunControls);
  50.     
  51.     myStyle = NewLayoutStyle((char *) "\pHoefler Text", ff(50), 0, nil, nil, 0, nil);
  52.     
  53.     layout = GXNewLayout(
  54.         1, &len, (void *) &myString,
  55.         1, &len, &myStyle,
  56.         1, &len, &level,
  57.         nil, &myPoint);
  58.     GXDrawShape(layout);
  59.     
  60.     gxRunControls.flags = gxImposeRightToLeft;
  61.     GXSetStyleRunControls(myStyle, &gxRunControls);
  62.     GXMoveShape(layout, 0, ff(75));
  63.     GXDrawShape(layout);
  64.     GXDisposeViewPort(aViewPort);
  65.     }    /* main */
  66.